import importlib


def import_class(class_path: str):
    if '.' not in class_path:
        raise ValueError(f"invalid class path: {class_path}。It should be like 'module.class_name'")

    module_path, class_name = class_path.rsplit('.', 1)

    try:
        module = importlib.import_module(module_path)
        class_obj = getattr(module, class_name)

        if not isinstance(class_obj, type):
            raise TypeError(f"{class_path} is not a class")
        return class_obj
    except ImportError as e:
        raise ImportError(f"Module for class {module_path} not found: {e}")
    except AttributeError as e:
        raise AttributeError(f"Class {class_path} not found: {e}")
